1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.Flap; 26 27 private import adw.SpringParams; 28 private import adw.SwipeableIF; 29 private import adw.SwipeableT; 30 private import adw.c.functions; 31 public import adw.c.types; 32 private import glib.ConstructionException; 33 private import gobject.ObjectG; 34 private import gtk.AccessibleIF; 35 private import gtk.AccessibleT; 36 private import gtk.BuildableIF; 37 private import gtk.BuildableT; 38 private import gtk.ConstraintTargetIF; 39 private import gtk.ConstraintTargetT; 40 private import gtk.OrientableIF; 41 private import gtk.OrientableT; 42 private import gtk.Widget; 43 44 45 /** 46 * An adaptive container acting like a box or an overlay. 47 * 48 * <picture> 49 * <source srcset="flap-wide-dark.png" media="(prefers-color-scheme: dark)"> 50 * <img src="flap-wide.png" alt="flap-wide"> 51 * </picture> 52 * <picture> 53 * <source srcset="flap-narrow-dark.png" media="(prefers-color-scheme: dark)"> 54 * <img src="flap-narrow.png" alt="flap-narrow"> 55 * </picture> 56 * 57 * The `AdwFlap` widget can display its children like a [class@Gtk.Box] does or 58 * like a [class@Gtk.Overlay] does, according to the 59 * [property@Flap:fold-policy] value. 60 * 61 * `AdwFlap` has at most three children: [property@Flap:content], 62 * [property@Flap:flap] and [property@Flap:separator]. Content is the primary 63 * child, flap is displayed next to it when unfolded, or overlays it when 64 * folded. Flap can be shown or hidden by changing the 65 * [property@Flap:reveal-flap] value, as well as via swipe gestures if 66 * [property@Flap:swipe-to-open] and/or [property@Flap:swipe-to-close] are set 67 * to `TRUE`. 68 * 69 * Optionally, a separator can be provided, which would be displayed between 70 * the content and the flap when there's no shadow to separate them, depending 71 * on the transition type. 72 * 73 * [property@Flap:flap] is transparent by default; add the 74 * [`.background`](style-classes.html#background) style class to it if this is 75 * unwanted. 76 * 77 * If [property@Flap:modal] is set to `TRUE`, content becomes completely 78 * inaccessible when the flap is revealed while folded. 79 * 80 * The position of the flap and separator children relative to the content is 81 * determined by orientation, as well as the [property@Flap:flap-position] 82 * value. 83 * 84 * Folding the flap will automatically hide the flap widget, and unfolding it 85 * will automatically reveal it. If this behavior is not desired, the 86 * [property@Flap:locked] property can be used to override it. 87 * 88 * Common use cases include sidebars, header bars that need to be able to 89 * overlap the window content (for example, in fullscreen mode) and bottom 90 * sheets. 91 * 92 * ## AdwFlap as GtkBuildable 93 * 94 * The `AdwFlap` implementation of the [iface@Gtk.Buildable] interface supports 95 * setting the flap child by specifying “flap” as the “type” attribute of a 96 * <child> element, and separator by specifying “separator”. Specifying 97 * “content” child type or omitting it results in setting the content child. 98 * 99 * ## CSS nodes 100 * 101 * `AdwFlap` has a single CSS node with name `flap`. The node will get the style 102 * classes `.folded` when it is folded, and `.unfolded` when it's not. 103 * 104 * Since: 1.0 105 */ 106 public class Flap : Widget, SwipeableIF, OrientableIF 107 { 108 /** the main Gtk struct */ 109 protected AdwFlap* adwFlap; 110 111 /** Get the main Gtk struct */ 112 public AdwFlap* getFlapStruct(bool transferOwnership = false) 113 { 114 if (transferOwnership) 115 ownedRef = false; 116 return adwFlap; 117 } 118 119 /** the main Gtk struct as a void* */ 120 protected override void* getStruct() 121 { 122 return cast(void*)adwFlap; 123 } 124 125 /** 126 * Sets our main struct and passes it to the parent class. 127 */ 128 public this (AdwFlap* adwFlap, bool ownedRef = false) 129 { 130 this.adwFlap = adwFlap; 131 super(cast(GtkWidget*)adwFlap, ownedRef); 132 } 133 134 // add the Swipeable capabilities 135 mixin SwipeableT!(AdwFlap); 136 137 // add the Orientable capabilities 138 mixin OrientableT!(AdwFlap); 139 140 141 /** */ 142 public static GType getType() 143 { 144 return adw_flap_get_type(); 145 } 146 147 /** 148 * Creates a new `AdwFlap`. 149 * 150 * Returns: the newly created `AdwFlap` 151 * 152 * Since: 1.0 153 * 154 * Throws: ConstructionException GTK+ fails to create the object. 155 */ 156 public this() 157 { 158 auto __p = adw_flap_new(); 159 160 if(__p is null) 161 { 162 throw new ConstructionException("null returned by new"); 163 } 164 165 this(cast(AdwFlap*) __p); 166 } 167 168 /** 169 * Gets the content widget for @self. 170 * 171 * Returns: the content widget for @self 172 * 173 * Since: 1.0 174 */ 175 public Widget getContent() 176 { 177 auto __p = adw_flap_get_content(adwFlap); 178 179 if(__p is null) 180 { 181 return null; 182 } 183 184 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 185 } 186 187 /** 188 * Gets the flap widget for @self. 189 * 190 * Returns: the flap widget for @self 191 * 192 * Since: 1.0 193 */ 194 public Widget getFlap() 195 { 196 auto __p = adw_flap_get_flap(adwFlap); 197 198 if(__p is null) 199 { 200 return null; 201 } 202 203 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 204 } 205 206 /** 207 * Gets the flap position for @self. 208 * 209 * Returns: the flap position for @self 210 * 211 * Since: 1.0 212 */ 213 public GtkPackType getFlapPosition() 214 { 215 return adw_flap_get_flap_position(adwFlap); 216 } 217 218 /** 219 * Gets the duration that fold transitions in @self will take. 220 * 221 * Returns: the fold transition duration 222 * 223 * Since: 1.0 224 */ 225 public uint getFoldDuration() 226 { 227 return adw_flap_get_fold_duration(adwFlap); 228 } 229 230 /** 231 * Gets the fold policy for @self. 232 * 233 * Returns: the fold policy for @self 234 * 235 * Since: 1.0 236 */ 237 public AdwFlapFoldPolicy getFoldPolicy() 238 { 239 return adw_flap_get_fold_policy(adwFlap); 240 } 241 242 /** 243 * Gets the fold threshold policy for @self. 244 * 245 * Since: 1.0 246 */ 247 public AdwFoldThresholdPolicy getFoldThresholdPolicy() 248 { 249 return adw_flap_get_fold_threshold_policy(adwFlap); 250 } 251 252 /** 253 * Gets whether @self is currently folded. 254 * 255 * Returns: `TRUE` if @self is currently folded 256 * 257 * Since: 1.0 258 */ 259 public bool getFolded() 260 { 261 return adw_flap_get_folded(adwFlap) != 0; 262 } 263 264 /** 265 * Gets whether @self is locked. 266 * 267 * Returns: `TRUE` if @self is locked 268 * 269 * Since: 1.0 270 */ 271 public bool getLocked() 272 { 273 return adw_flap_get_locked(adwFlap) != 0; 274 } 275 276 /** 277 * Gets whether @self is modal. 278 * 279 * Returns: `TRUE` if @self is modal 280 * 281 * Since: 1.0 282 */ 283 public bool getModal() 284 { 285 return adw_flap_get_modal(adwFlap) != 0; 286 } 287 288 /** 289 * Gets whether the flap widget is revealed for @self. 290 * 291 * Returns: `TRUE` if the flap widget is revealed 292 * 293 * Since: 1.0 294 */ 295 public bool getRevealFlap() 296 { 297 return adw_flap_get_reveal_flap(adwFlap) != 0; 298 } 299 300 /** 301 * Gets the reveal animation spring parameters for @self. 302 * 303 * Returns: the reveal animation parameters 304 * 305 * Since: 1.0 306 */ 307 public SpringParams getRevealParams() 308 { 309 auto __p = adw_flap_get_reveal_params(adwFlap); 310 311 if(__p is null) 312 { 313 return null; 314 } 315 316 return ObjectG.getDObject!(SpringParams)(cast(AdwSpringParams*) __p, true); 317 } 318 319 /** 320 * Gets the current reveal progress for @self. 321 * 322 * Returns: the current reveal progress for @self 323 * 324 * Since: 1.0 325 */ 326 public double getRevealProgress() 327 { 328 return adw_flap_get_reveal_progress(adwFlap); 329 } 330 331 /** 332 * Gets the separator widget for @self. 333 * 334 * Returns: the separator widget for @self 335 * 336 * Since: 1.0 337 */ 338 public Widget getSeparator() 339 { 340 auto __p = adw_flap_get_separator(adwFlap); 341 342 if(__p is null) 343 { 344 return null; 345 } 346 347 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 348 } 349 350 /** 351 * Gets whether @self can be closed with a swipe gesture. 352 * 353 * Returns: `TRUE` if @self can be closed with a swipe gesture 354 * 355 * Since: 1.0 356 */ 357 public bool getSwipeToClose() 358 { 359 return adw_flap_get_swipe_to_close(adwFlap) != 0; 360 } 361 362 /** 363 * Gets whether @self can be opened with a swipe gesture. 364 * 365 * Returns: `TRUE` if @self can be opened with a swipe gesture 366 * 367 * Since: 1.0 368 */ 369 public bool getSwipeToOpen() 370 { 371 return adw_flap_get_swipe_to_open(adwFlap) != 0; 372 } 373 374 /** 375 * Gets the type of animation used for reveal and fold transitions in @self. 376 * 377 * Returns: the current transition type of @self 378 * 379 * Since: 1.0 380 */ 381 public AdwFlapTransitionType getTransitionType() 382 { 383 return adw_flap_get_transition_type(adwFlap); 384 } 385 386 /** 387 * Sets the content widget for @self. 388 * 389 * Params: 390 * content = the content widget 391 * 392 * Since: 1.0 393 */ 394 public void setContent(Widget content) 395 { 396 adw_flap_set_content(adwFlap, (content is null) ? null : content.getWidgetStruct()); 397 } 398 399 /** 400 * Sets the flap widget for @self. 401 * 402 * Params: 403 * flap = the flap widget 404 * 405 * Since: 1.0 406 */ 407 public void setFlap(Widget flap) 408 { 409 adw_flap_set_flap(adwFlap, (flap is null) ? null : flap.getWidgetStruct()); 410 } 411 412 /** 413 * Sets the flap position for @self. 414 * 415 * Params: 416 * position = the new value 417 * 418 * Since: 1.0 419 */ 420 public void setFlapPosition(GtkPackType position) 421 { 422 adw_flap_set_flap_position(adwFlap, position); 423 } 424 425 /** 426 * Sets the duration that fold transitions in @self will take. 427 * 428 * Params: 429 * duration = the new duration, in milliseconds 430 * 431 * Since: 1.0 432 */ 433 public void setFoldDuration(uint duration) 434 { 435 adw_flap_set_fold_duration(adwFlap, duration); 436 } 437 438 /** 439 * Sets the fold policy for @self. 440 * 441 * Params: 442 * policy = the fold policy 443 * 444 * Since: 1.0 445 */ 446 public void setFoldPolicy(AdwFlapFoldPolicy policy) 447 { 448 adw_flap_set_fold_policy(adwFlap, policy); 449 } 450 451 /** 452 * Sets the fold threshold policy for @self. 453 * 454 * Params: 455 * policy = the policy to use 456 * 457 * Since: 1.0 458 */ 459 public void setFoldThresholdPolicy(AdwFoldThresholdPolicy policy) 460 { 461 adw_flap_set_fold_threshold_policy(adwFlap, policy); 462 } 463 464 /** 465 * Sets whether @self is locked. 466 * 467 * Params: 468 * locked = the new value 469 * 470 * Since: 1.0 471 */ 472 public void setLocked(bool locked) 473 { 474 adw_flap_set_locked(adwFlap, locked); 475 } 476 477 /** 478 * Sets whether @self is modal. 479 * 480 * Params: 481 * modal = whether @self is modal 482 * 483 * Since: 1.0 484 */ 485 public void setModal(bool modal) 486 { 487 adw_flap_set_modal(adwFlap, modal); 488 } 489 490 /** 491 * Sets whether the flap widget is revealed for @self. 492 * 493 * Params: 494 * revealFlap = whether to reveal the flap widget 495 * 496 * Since: 1.0 497 */ 498 public void setRevealFlap(bool revealFlap) 499 { 500 adw_flap_set_reveal_flap(adwFlap, revealFlap); 501 } 502 503 /** 504 * Sets the reveal animation spring parameters for @self. 505 * 506 * Params: 507 * params = the new parameters 508 * 509 * Since: 1.0 510 */ 511 public void setRevealParams(SpringParams params) 512 { 513 adw_flap_set_reveal_params(adwFlap, (params is null) ? null : params.getSpringParamsStruct()); 514 } 515 516 /** 517 * Sets the separator widget for @self. 518 * 519 * Params: 520 * separator = the separator widget 521 * 522 * Since: 1.0 523 */ 524 public void setSeparator(Widget separator) 525 { 526 adw_flap_set_separator(adwFlap, (separator is null) ? null : separator.getWidgetStruct()); 527 } 528 529 /** 530 * Sets whether @self can be closed with a swipe gesture. 531 * 532 * Params: 533 * swipeToClose = whether @self can be closed with a swipe gesture 534 * 535 * Since: 1.0 536 */ 537 public void setSwipeToClose(bool swipeToClose) 538 { 539 adw_flap_set_swipe_to_close(adwFlap, swipeToClose); 540 } 541 542 /** 543 * Sets whether @self can be opened with a swipe gesture. 544 * 545 * Params: 546 * swipeToOpen = whether @self can be opened with a swipe gesture 547 * 548 * Since: 1.0 549 */ 550 public void setSwipeToOpen(bool swipeToOpen) 551 { 552 adw_flap_set_swipe_to_open(adwFlap, swipeToOpen); 553 } 554 555 /** 556 * Sets the type of animation used for reveal and fold transitions in @self. 557 * 558 * Params: 559 * transitionType = the new transition type 560 * 561 * Since: 1.0 562 */ 563 public void setTransitionType(AdwFlapTransitionType transitionType) 564 { 565 adw_flap_set_transition_type(adwFlap, transitionType); 566 } 567 }